from panda3d.core import Point2,Point3,Vec2,Vec3,Vec4
'''
	Andrew Oberlin, Tom Williams, Mike Jacobs
	Date: February 21, 2012
'''
class Item:
	'''
		Creates the coin
	'''
	def __init__(self, parent):
		self.parent = parent
		self.type = 'COIN'
		self.alive = True
		self.loadModel()
		self.set2DProps()
		
	'''
		Loads the coin plane
	'''
	def loadModel(self):
		self.model = self.parent.loader.loadModelCopy("models/plane")
		self.texture = self.parent.loader.loadTexture("models/levels/objects/coin.png")
	
	'''
		Sets the properties for a two dimensional figure
	'''
	def set2DProps(self):
		self.model.setHpr(Vec3(0,-90,0))
		self.model.setScale(self.parent.BLOCK_SIZE)
		
		# maximize efficiency
		self.model.setBin("unsorted", 0)
		self.model.setDepthTest(False)
		self.model.setTransparency(1)
		
		self.model.setTexture(self.texture)
		self.model.reparentTo(render)
		
	'''
		Removes the block from the Panda3D render and destroys the block
	'''
	def destroy(self):
		self.model.removeNode()
		

	
class Mushroom(Item):
	'''
		Initializes a mushroom object
	'''
	def __init__(self, parent):
		self.parent = parent
		self.type = 'MUSHROOM'
		self.alive = True
		self.loadModel()
		self.set2DProps()
		
	'''
		Loads the mushroom texture onto the object
	'''
	def loadModel(self):
		self.model = self.parent.loader.loadModelCopy("models/plane")
		self.texture = self.parent.loader.loadTexture("models/levels/objects/mushroom.png")
	
	
	